using System.Collections.Generic;
namespace Lifter.Device.Unit
{
    public class LifterPortComparer : IComparer<LifterPort>
    {
        public int Compare(LifterPort x, LifterPort y)
        {
            int result;
            if (x == null)
            {
                if (y == null)
                {
                    result = 0;
                }
                else
                {
                    result = 1;
                }
            }
            else
            {
                if (y == null)
                {
                    result = -1;
                }
                else
                {
                    int num = int.Parse(y.PlcID);
                    int num2 = int.Parse(x.PlcID);
                    if (num < num2)
                    {
                        result = 1;
                    }
                    else
                    {
                        if (num > num2)
                        {
                            result = -1;
                        }
                        else
                        {
                            result = 0;
                        }
                    }
                }
            }
            return result;
        }
    }
}
